# Maintainer: David Runge <dvzrv@archlinux.org>

_name=flufl.i18n
pkgname=python-flufl.i18n
pkgver=4.1.1
pkgrel=2
pkgdesc="A high level API for internationalization"
arch=(any)
url="https://gitlab.com/warsaw/flufl.i18n"
license=(Apache)
depends=(python-atpublic)
makedepends=(python-build python-installer python-pdm-pep517)
checkdepends=(python-sybil python-pytest)
provides=(python-flufl-i18n)
replaces=(python-flufl-i18n)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('3c35625c95321c7e29652a97cfd9ae93cdccbd1eedc804502353d36643f761f7922c5007f39199a7d28c0d3d97d788b767add783cd1309dd52e6d1a0c1f5589e')
b2sums=('a71e16d952216565e8be8f05ce473c3ed1e85e4c747b09913103223e8f018482134081cceffc2e434fe95e76a58f2dabe9a5f2343c6ed4b10377c528414fd045')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd $_name-$pkgver
  # install to temporary location, as importlib is used
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
  pytest -vv -c /dev/null
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.rst -t "$pkgdir/usr/share/doc/$pkgname/"
}
